package com.ndp.fb.scheduler;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.ndp.fb.config.BaseConfig;
import com.ndp.fb.constant.ConfigConst;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * Created by infi on 2015/1/23.
 */

public class SchedulerApplication extends BaseConfig {

    @Override
    public ApplicationConfig registerApplicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName(ConfigConst.SCHEDULER_SERVICES_ID);
        return applicationConfig;
    }
    @Override
    public String getRegistryGroup() {
        return ConfigConst.DUBBO_REGISTER_GROUP;
    }


    @Bean
    public ThreadPoolTaskExecutor initThreadPoolTaskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(100);
        return taskExecutor;
    }
    @Bean
    public ThreadPoolTaskScheduler initThreadPoolTaskScheduler(){
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(100);
        return scheduler;
    }


}
